<?php

namespace App\Models\finance;

use App\Models\AdminModel;
use App\Models\AgentModel;
use App\Models\base\CurrencyModel;
use App\Models\OrderModel;
use App\Models\StaffModel;
use App\Models\TakeOrderModel;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model as BaseModel;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;

class CompensationModel extends BaseModel
{
    use HasFactory, SoftDeletes;

    protected $table = 't_finance_compensation';

    protected $primaryKey = 'id';

    public $timestamps = true;

    const CREATED_AT = 'created_at';
    
    const UPDATED_AT = null;

    const STATUS = [1 => '待赔付', 2 => '已赔付'];

    protected $guarded = [];

    protected $hidden = [
        'deleted_at',
    ];

    //代理商
    public function agent() : BelongsTo {
        return $this->belongsTo(AgentModel::class, 'agent_id');
    }

    //提单
    public function take_order(): BelongsTo {
        return $this->belongsTo(TakeOrderModel::class, 'take_order_id');
    }

    //操作人
    public function compensate_admin(): BelongsTo {
        return $this->belongsTo(AdminModel::class, 'compensate_admin_id');
    }

    //申请币种
    public function currency(): BelongsTo {
        return $this->belongsTo(CurrencyModel::class, 'currency_id');
    }

    //实际赔付币种
    public function actual_currency(): BelongsTo {
        return $this->belongsTo(CurrencyModel::class, 'actual_currency_id');
    }



}
